app.service('homeService',function () {
    var localStorage = window.localStorage;
    this.setData = function (newData) {
        localStorage.setItem('chartsData',newData);
    };
    this.getData = function (){
        return localStorage.getItem('chartsData')
    }
}).controller('HomeCtrl',['$scope','$http','homeService','$location',function($scope,$http,homeService,$location){
    var token = localStorage.getItem('token');

        $http({
            method: "POST",
            url: mainUrl+'/md/md-pdata!findNow4App.action',
            params: {
                'Authorization': token ,

                'qm.company' : 'GF'
            }
        }).then(
            function(data, status, headers, config){
                    console.log(data);
                    console.log(data.status);
                    /*$scope.content=data.data.items[0].content;*/
                    /*for(var i=0;i<data.data.items.length;i++){
                        $scope.content+=data.data.items[i].title;
                    }*/
                    homeService.setData(JSON.stringify(data));




            },function(data, status, headers, config){
                mui.toast('登录超时,请重新登陆')
                $location.path('/')
            }
        )
    //
}]);